<template>
	<view>
		<view class="box">
			<view :class="item.description?'item':'item grayitem'" v-for="(item,index) in devList" :key="index" @click="gobind(item)">
				<text style="margin: auto;">
					{{item.factoryName}}
				</text>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getfactoryList
	} from '@/api/system'
	export default {
		data() {
			return {
				devList: []
			}
		},
		onLoad() {
			this.getDataList()
		},
		methods: {
			async getDataList() {
				const result = await getfactoryList()
				this.devList = result.data || []
			},
			gobind(item) {
				if (!item.description) {
					return uni.showToast({
						title: '请先配置该厂家页面路由',
						icon: 'none'
					});
				}
				uni.navigateTo({
					url: item.description
				})
			},
			back() {
				uni.navigateBack();
			}
		}
	}
</script>

<style lang="scss" scoped>
	.box {
		padding: 10px;
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;

		.item {
			margin-top: 20px;
			width: 200rpx;
			height: 200rpx;
			border: 1px solid #2979ff;
			border-radius: 5%;
			display: flex;
			justify-content: center;
			align-items: center;
			color: #2979ff;
			font-weight: 600;
			font-size: 18px;
			letter-spacing: 2px;
		}
		.grayitem{
			border: 1px solid gray;
			color: gray;
		}
	}
</style>